Skip to content

Propagate DynamicallyAccessedMembersAttribute to type inference method #11856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 17, 2025

Conversation

jjonescz
Copy link
Member

@jjonescz jjonescz commented May 13, 2025

Fixes #11718.

Review commit-by-commit to see codegen diff.

@jjonescz jjonescz marked this pull request as ready for review May 13, 2025 13:30
@jjonescz jjonescz requested review from a team as code owners May 13, 2025 13:30
@jaredpar jaredpar requested a review from 333fred May 13, 2025 16:46
@@ -445,6 +447,64 @@ private static void CreateTypeParameterProperty(TagHelperDescriptorBuilder build
metadataPairs.Add(new(ComponentMetadata.Component.TypeParameterConstraintsKey, whereClauseText));
}

// Collect attributes that should be propagated to the type inference method.
var withAttributes = StringBuilderPool.GetPooledObject();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason not to use the standard using pattern for pooled objects? After all, that's the pattern used in the code above for metadataPairs and would avoid all of the extra accesses for Object below.

using var _ = StringBuilderPool.GetPooledObject(out var withAtttributes);

@jjonescz
Copy link
Member Author

@333fred @DustinCampbell @dotnet/razor-compiler for a second review, thanks

@jjonescz jjonescz merged commit 013cbf5 into dotnet:main May 17, 2025
11 checks passed
@jjonescz jjonescz deleted the 11718-DynamicallyAccessedMembers branch May 17, 2025 08:32
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone May 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InputBase<TValue> produces trim warnings IL2091 for built in types
4 participants